<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<script type="text/javascript" src="./lib/cuon-matrix.js"></script>
<script type="text/javascript" src="./lib/cuon-utils.js"></script>
<script type="text/javascript" src="./lib/webgl-debug.js"></script>
<script type="text/javascript" src="./lib/webgl-utils.js"></script>
<script type="text/javascript">

var VSHADER_SOURCE =
'attribute vec4 a_Position;'+
'void main(){'+
'gl_Position = a_Position;'+
'gl_PointSize = 10.0;}';

var FSHADER_SOURCE =
'void main(){'+
'gl_FragColor = vec4(1.0,0.0,0.0,1.0);'+
'}';
function start () {
	var canvas = document.getElementById('webgl');
	var gl  = getWebGLContext(canvas);
	if (!gl){
		alert('gl 初始化失败');
		return
	}
	if(!initShaders(gl,VSHADER_SOURCE,FSHADER_SOURCE)){
		alert('gl 着色器失败')
		return
	}

	var a_Position =gl.getAttribLocation(gl.program,'a_Position');
	if (a_Position < 0) {
		alert('a_Position 失败')
		return
	}
	gl.vertexAttrib4f(a_Position,1.0,1.0,0.0,1.0);
	gl.clearColor(0.0,0.0,0.0,1.0);
	gl.clear(gl.COLOR_BUFFER_BIT);
	gl.drawArrays(gl.POINTS,0,1);

}

</script>

<body onload="start()">
	<canvas id = "webgl" width="100" height="500"></canvas>
</body>
</html>